package service.impl;

import dao.DoctorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.Doctor;
import service.DoctorService;

import java.util.List;

@Service
public class DoctorServiceImpl implements DoctorService {

    @Autowired
    private DoctorMapper doctorMapper;

    @Override
    public List<Doctor> findAll() {
        return doctorMapper.findAll();
    }

    @Override
    public Doctor findById(String docId) {
        return doctorMapper.findById(docId);
    }

    @Override
    public Doctor findByUserId(String userId) {
        return doctorMapper.findByUserId(userId);
    }

    @Override
    public Doctor findByUserName(String userName) {
        return doctorMapper.findByUserName(userName);
    }

    @Override
    public int add(Doctor doctor) {
        return doctorMapper.addDoctor(doctor);
    }

    @Override
    public int update(Doctor doctor) {
        return doctorMapper.updateDoctor(doctor);
    }

    // 新增方法实现
    @Override
    public int updateByUserId(Doctor doctor) {
        return doctorMapper.updateDoctorByUserId(doctor);
    }

    @Override
    public int deleteDoctor(String docId) {
        return doctorMapper.deleteDoctor(docId);
    }
}